import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import ClientLayout from './components/ClientLayout';
import AdminLayout from './components/AdminLayout';
import TabLayout from './pages/client/TabLayout';
import DishList from './pages/client/DishList';
import DishManagement from './pages/admin/DishManagement';
import CategoryManagement from './pages/admin/CategoryManagement';
import TagManagement from './pages/admin/TagManagement';
import DataInit from './pages/admin/DataInit';
import './App.css';
import './responsive.css';

function App() {
  return (
    <ConfigProvider locale={zhCN}>
      <Router>
        <div className="App">
          <Routes>
            {/* C端路由 */}
            <Route path="/" element={<ClientLayout />}>
              <Route index element={<TabLayout />} />
              <Route path="dishes" element={<DishList />} />
            </Route>
            
            {/* 后台管理路由 */}
            <Route path="/admin" element={<AdminLayout />}>
              <Route index element={<Navigate to="/admin/dishes" replace />} />
              <Route path="dishes" element={<DishManagement />} />
              <Route path="categories" element={<CategoryManagement />} />
              <Route path="tags" element={<TagManagement />} />
              <Route path="init" element={<DataInit />} />
            </Route>
          </Routes>
        </div>
      </Router>
    </ConfigProvider>
  );
}

export default App;